#include<stdio.h>

int main()
{
	int m,n,sign=1,flag=0,x=0,y=0;
	int a[100][100]={0};
	scanf("%d %d",&m,&n);
	a[0][0]=1;
	while(sign<m*n)
	{
		while(x+1<n&&a[y][x+1]==0) a[y][++x]=++sign;
		while(y+1<m&&a[y+1][x]==0) a[++y][x]=++sign;
		while(x>0&&a[y][x-1]==0) a[y][--x]=++sign;
		while(y>0&&a[y-1][x]==0) a[--y][x]=++sign;
	}
	printf("\n");
	for(sign=0;sign<m;sign++)
	{
		for(flag=0;flag<n;flag++)
		{
			printf("%d ",a[sign][flag]);
		}
		printf("\n");
	}
	return 0;
}
